package Math类编程题;

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

public class LearnBigDecimal {
    public static void main(String[] args) {
        System.out.println("3的5次幂: "+
                new BigDecimal("3").pow(5)
                );
        System.out.println("计算3.2向上取整的结果: "+
                new BigDecimal("3.2",new MathContext(1, RoundingMode.CEILING))
                );
        System.out.println("计算3.8向下取整的结果: "+
                new BigDecimal("3.8",new MathContext(1,RoundingMode.DOWN))
                );
        System.out.println("计算5.6四舍五入取整的结果: "+
                new BigDecimal("5.6",new MathContext(1,RoundingMode.HALF_UP))
                );
    }
}
